#include "tableGencode.h"

void initTableGencode()
{
	int i;
	
	for(i=0;i<TABLE_GENCODE_SIZE;i++)
	{
		tableGencode[i] = NULL;
	}
	
	nbElementGencode = 0;
}

int ajoutTableGencode(char * commande, char * adresse1, char * adresse2, char * adresse3)
{
	pligneCode new = malloc(sizeof(struct ligneCode));
	
	new->commande = commande;
	new->adresse1 = adresse1;
	new->adresse2 = adresse2;
	new->adresse3 = adresse3;
	new->pointee = 0;
	
	tableGencode[nbElementGencode] = new;
	nbElementGencode ++;
	return nbElementGencode -1;
}

void ajoutPointer (int i)
{
	tableGencode[i]->pointee = 1;
}

void afficheTableGencode()
{
	int i;
	
	printf("\nTable Gencode\n");
	
	for(i=0;i<nbElementGencode;i++)
	{
		printf("\t%s %s %s %s\n",tableGencode[i]->commande,tableGencode[i]->adresse1,tableGencode[i]->adresse2,tableGencode[i]->adresse3);
	}
	
	printf("\n");
}
